home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / CIncludes / Picker.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  2.4 KB  |  91 lines  |  [TEXT/MPS ]

  1.  
  2. /************************************************************
  3.  
  4. Created: Friday, September 13, 1991 at 1:08 PM
  5.  Picker.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1987-1991
  10.   All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __PICKER__
  16. #define __PICKER__
  17.  
  18. #ifndef __QUICKDRAW__
  19. #include <Quickdraw.h>
  20. #endif
  21.  
  22.  
  23. enum {
  24.  
  25.  MaxSmallFract = 0x0000FFFF            /*Maximum small fract value, as long*/
  26. };
  27.  
  28. /* A SmallFract value is just the fractional part of a Fixed number,
  29. which is the low order word.  SmallFracts are used to save room,
  30. and to be compatible with Quickdraw's RGBColor.  They can be
  31. assigned directly to and from INTEGERs. */
  32.  
  33. typedef unsigned short SmallFract;    /* Unsigned fraction between 0 and 1 */
  34.  
  35. /* For developmental simplicity in switching between the HLS and HSV
  36. models, HLS is reordered into HSL. Thus both models start with
  37. hue and saturation values; value/lightness/brightness is last. */
  38.  
  39. struct HSVColor {
  40.  SmallFract hue;                    /*Fraction of circle, red at 0*/
  41.  SmallFract saturation;                /*0-1, 0 for gray, 1 for pure color*/
  42.  SmallFract value;                    /*0-1, 0 for black, 1 for max intensity*/
  43. };
  44.  
  45. typedef struct HSVColor HSVColor;
  46.  
  47. struct HSLColor {
  48.  SmallFract hue;                    /*Fraction of circle, red at 0*/
  49.  SmallFract saturation;                /*0-1, 0 for gray, 1 for pure color*/
  50.  SmallFract lightness;                /*0-1, 0 for black, 1 for white*/
  51. };
  52.  
  53. typedef struct HSLColor HSLColor;
  54.  
  55. struct CMYColor {
  56.  SmallFract cyan;
  57.  SmallFract magenta;
  58.  SmallFract yellow;
  59. };
  60.  
  61. typedef struct CMYColor CMYColor;
  62.  
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. pascal SmallFract Fix2SmallFract(Fixed f)
  68.  = {0x3F3C,0x0001,0xA82E}; 
  69. pascal Fixed SmallFract2Fix(SmallFract s)
  70.  = {0x3F3C,0x0002,0xA82E}; 
  71. pascal void CMY2RGB(const CMYColor *cColor,RGBColor *rColor)
  72.  = {0x3F3C,0x0003,0xA82E}; 
  73. pascal void RGB2CMY(const RGBColor *rColor,CMYColor *cColor)
  74.  = {0x3F3C,0x0004,0xA82E}; 
  75. pascal void HSL2RGB(const HSLColor *hColor,RGBColor *rColor)
  76.  = {0x3F3C,0x0005,0xA82E}; 
  77. pascal void RGB2HSL(const RGBColor *rColor,HSLColor *hColor)
  78.  = {0x3F3C,0x0006,0xA82E}; 
  79. pascal void HSV2RGB(const HSVColor *hColor,RGBColor *rColor)
  80.  = {0x3F3C,0x0007,0xA82E}; 
  81. pascal void RGB2HSV(const RGBColor *rColor,HSVColor *hColor)
  82.  = {0x3F3C,0x0008,0xA82E}; 
  83. pascal Boolean GetColor(Point where,ConstStr255Param prompt,const RGBColor *inColor,
  84.  RGBColor *outColor)
  85.  = {0x3F3C,0x0009,0xA82E}; 
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #endif
  91.